
package com.limoilux.cobolux.core;

import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;

public class CoboluxCoreUtils
{
	private CoboluxCoreUtils()
	{

	}

	public static IWorkspaceRoot getWorkspaceRoot()
	{
		return ResourcesPlugin.getWorkspace().getRoot();
	}

	public static String removeExtension(String filePath)
	{
		String out = null;
		int lastPeriod = 0;
		int temp = 0;

		temp = filePath.indexOf(".");
		lastPeriod = temp;

		while (temp != -1)
		{
			temp = filePath.indexOf(".", temp + 1);

			if (temp != -1)
			{
				lastPeriod = temp;
			}
		}

		if (lastPeriod != -1)
		{
			out = filePath.substring(0, lastPeriod);
		}
		else
		{
			out = filePath;
		}

		return out;
	}
}
